<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>#InstallMouseHook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>#InstallMouseHook</h1>

<p>Forces the unconditional installation of the mouse hook.</p>

<pre class="Syntax">#InstallMouseHook</pre>
<h3>Remarks</h3>
<p>The mouse hook monitors mouse clicks for the purpose of activating mouse <a href="../Hotkeys.htm">hotkeys</a> and <a href="../Hotstrings.htm#NoMouse">facilitating hotstrings</a>.</p>
<p>AutoHotkey does not install the keyboard and mouse hooks unconditionally because together they consume at least 500 KB of memory (but if the keyboard hook is installed, installing the mouse hook only requires about 50 KB of additional memory; and vice versa). Therefore, the mouse hook is normally installed only when the script contains one or more mouse <a href="../Hotkeys.htm">hotkeys</a>. It is also installed for <a href="../Hotstrings.htm">hotstrings</a>, but that can be disabled via <a href="_Hotstring.htm">#Hotstring NoMouse</a>.</p>
<p>By contrast, the #InstallMouseHook directive will unconditionally install the mouse hook, which might be useful to allow <a href="KeyHistory.htm">KeyHistory</a> to monitor mouse clicks.</p>
<p>You can determine whether a script is using the hook via the <a href="KeyHistory.htm">KeyHistory</a> command or menu item. You can determine which hotkeys are using the hook via the <a href="ListHotkeys.htm">ListHotkeys</a> command or menu item.</p>
<p>This directive also makes a script <a href="_Persistent.htm">persistent</a>, meaning that <a href="ExitApp.htm">ExitApp</a> should be used to terminate it.</p>
<h3>Related</h3>
<p><a href="_InstallKeybdHook.htm">#InstallKeybdHook</a>, <a href="_UseHook.htm">#UseHook</a>, <a href="Hotkey.htm">Hotkey</a>, <a href="_Persistent.htm">#Persistent</a>, <a href="KeyHistory.htm">KeyHistory</a>, <a href="GetKeyState.htm">GetKeyState</a>, <a href="KeyWait.htm">KeyWait</a></p>
<h3>Example</h3>
<pre class="NoIndent">#InstallMouseHook</pre>

</body>
</html>
